package com.google.projectulator;

import groovy.lang.Binding;

public class GroovyProjectProcessor extends GroovyProcessor {	
	public static final String PROJECT_STATE_NAME = "projectState";
	public static final String PROJECT_NAME = "project";
	
	@Override
	protected void loadBinding(Context context, Binding runtimeBinding) {
		runtimeBinding.setVariable(PROJECT_STATE_NAME, context.getCurrentProject());
		runtimeBinding.setVariable(PROJECT_NAME, context.getCurrentProject().getMavenProject());
	}
	
	@Override
	protected void postExecution(Context context, Binding runtimeBinding) {
		if (runtimeBinding.getVariable("$CONTINUE") == Boolean.FALSE) {
			context.setContinuing(false);
		}
	}
	
	@Override
	public String toString() {
		return "GroovyProjectProcessor(" + name + ")";
	}
}